<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                template="/templates/template.xhtml">
    <ui:define name="title">主体信息</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-edit"
                                         actionListener="#{xhhSettlementCompanyInfoBean.changeStatusToEdit}"
                                         process="@this"
                                         update="@form" rendered="#{xhhSettlementCompanyInfoBean.isView()}"/>
                        <p:commandButton value="保存" icon="fa fa-save"
                                         action="#{xhhSettlementCompanyInfoBean.onSave()}"
                                         update="@form"
                                         rendered="#{xhhSettlementCompanyInfoBean.isAdd() || xhhSettlementCompanyInfoBean.isEdit()}"/>
                        <p:commandButton icon="fa fa-reply-all" value="返回"
                                         action="#{xhhSettlementCompanyInfoBean.onReturn(currentUserBean.back)}"
                                         process="@this"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-g ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12 ">
                    <div class="card ui-g-12">
                        <h1>基础信息</h1>
                        <p:panelGrid columns="4" layout="grid"
                                     columnClasses="ui-grid-col-1,ui-grid-col-5,ui-grid-col-1,ui-grid-col-5"
                                     styleClass="ui-panelgrid-blank"
                                     style="border:0px none; background-color:transparent;text-align:left;">
                            <p:outputLabel value="所属项目"/>
                            <p:selectOneMenu id="project" value="#{xhhSettlementCompanyInfoBean.$.billProject}"
                                             disabled="#{xhhSettlementCompanyInfoBean.isView()}">
                                <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                              noSelectionOption="true"/>
                                <f:selectItems
                                        value="#{xhhSettlementCompanyInfoBean.dictionaries[DictionaryCode.XHH_SETTLEMENT_BILLING_PROJECT]}"
                                        var="dic"
                                        itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                            </p:selectOneMenu>
                            <p:outputLabel value="开票主体"/>
                            <p:inputText id="companyName" value="#{xhhSettlementCompanyInfoBean.$.companyName}"
                                         disabled="#{xhhSettlementCompanyInfoBean.isView()}"/>

                            <p:outputLabel value="是否开票"/>
                            <p:inputSwitch id="isBill" onLabel="是" offLabel="否"
                                           value="#{xhhSettlementCompanyInfoBean.$.isBill}"
                                           disabled="#{xhhSettlementCompanyInfoBean.isView()}">
                                <p:ajax event="change" process="@this"
                                        update="pricePanel"/>
                            </p:inputSwitch>
                        </p:panelGrid>

                        <p:outputPanel id="pricePanel">
                            <p:outputPanel rendered="#{xhhSettlementCompanyInfoBean.$.isBill==true}">
                                <p:panelGrid columns="4" layout="grid"
                                             columnClasses="ui-grid-col-1,ui-grid-col-5,ui-grid-col-1,ui-grid-col-5"
                                             styleClass="ui-panelgrid-blank"
                                             style="border:0px none; background-color:transparent;text-align:left;">
                                    <p:outputLabel value="开票内容"/>
                                    <p:selectOneMenu id="billContent" value="#{xhhSettlementCompanyInfoBean.$.billContent}"
                                                     disabled="#{xhhSettlementCompanyInfoBean.isView()}">
                                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                                      noSelectionOption="true"/>
                                        <f:selectItems
                                                value="#{xhhSettlementCompanyInfoBean.dictionaries[DictionaryCode.XHH_SETTLEMENT_BILLING_CONTENT]}"
                                                var="dic"
                                                itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                    </p:selectOneMenu>

                                    <p:outputLabel value="发票类型"/>
                                    <p:selectOneMenu id="billType" value="#{xhhSettlementCompanyInfoBean.$.billType}"
                                                     disabled="#{xhhSettlementCompanyInfoBean.isView()}">
                                        <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                                      noSelectionOption="true"/>
                                        <f:selectItems
                                                value="#{xhhSettlementCompanyInfoBean.dictionaries[DictionaryCode.XHH_SETTLEMENT_BILL_TYPE]}"
                                                var="dic"
                                                itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                    </p:selectOneMenu>

                                    <p:outputLabel value="登记税号"/>
                                    <p:inputText id="taxNumber" value="#{xhhSettlementCompanyInfoBean.$.taxNumber}"
                                                 disabled="#{xhhSettlementCompanyInfoBean.isView()}"/>

                                    <p:outputLabel value="开户账户"/>
                                    <p:inputText id="bankAccount" value="#{xhhSettlementCompanyInfoBean.$.bankAccount}"
                                                 disabled="#{xhhSettlementCompanyInfoBean.isView()}"/>

                                    <p:outputLabel value="开户支行"/>
                                    <p:inputText id="offlineCount" value="#{xhhSettlementCompanyInfoBean.$.bankAddress}"
                                                 disabled="#{xhhSettlementCompanyInfoBean.isView()}"/>

                                    <p:outputLabel value="开户卡号"/>
                                    <p:inputText id="bankNumber" value="#{xhhSettlementCompanyInfoBean.$.bankNumber}"
                                                 disabled="#{xhhSettlementCompanyInfoBean.isView()}"/>

                                    <p:outputLabel value="公司手机号"/>
                                    <p:inputText id="companyphone" value="#{xhhSettlementCompanyInfoBean.$.companyPhone}"
                                                 disabled="#{xhhSettlementCompanyInfoBean.isView()}"/>

                                    <p:outputLabel value="开票地址"/>
                                    <p:inputText id="billAddress" value="#{xhhSettlementCompanyInfoBean.$.billAddress}"
                                                 disabled="#{xhhSettlementCompanyInfoBean.isView()}"/>

                                    <p:outputLabel value="收件人姓名"/>
                                    <p:inputText id="receiveName" value="#{xhhSettlementCompanyInfoBean.$.receiveName}"
                                                 disabled="#{xhhSettlementCompanyInfoBean.isView()}"/>

                                    <p:outputLabel value="收件人手机"/>
                                    <p:inputText id="receivePhone" value="#{xhhSettlementCompanyInfoBean.$.receivePhone}"
                                                 disabled="#{xhhSettlementCompanyInfoBean.isView()}"/>

                                    <p:outputLabel value="收件地址"/>
                                    <p:inputText id="receiveAddress"
                                                 value="#{xhhSettlementCompanyInfoBean.$.receiveAddress}"
                                                 disabled="#{xhhSettlementCompanyInfoBean.isView()}"/>
                                </p:panelGrid>
                            </p:outputPanel>
                        </p:outputPanel>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>